<template>
  <van-nav-bar
    title="商品列表"
    left-text="返回"
    left-arrow
    @click-left="onClickLeft"
  />

  <van-card
    v-for="item in categoryBrandProList"
    :key="item.proid"
    :price="item.originprice + '.00'"
    :title="item.proname"
    :thumb="item.img1"
    @click="onGoDetail(item.proid)"
  />
</template>

<script>
import { getCategoryBrandProApi } from "@/api/class.js";
export default {
  name: "Category",
  data() {
    return {
      brand: this.$route.query.goodsBrand, // 分类品牌
      category: this.$route.query.category, // 产品分类
      categoryBrandProList: [],
    };
  },
  methods: {
    onClickLeft() {
      this.$router.back(-1);
    },
    onGoDetail(id) {
      this.$router.push("/Detail/" + id);
    },
    async getCategoryBrandPro() {
      let res = await getCategoryBrandProApi({
        count: 1,
        limitNum: 10,
        category: this.category,
        brand: this.brand,
      });
      if (res.data.code == 200) {
        console.log("res", res);
        this.categoryBrandProList = res.data.data;
      }
    },
  },
  created() {
    this.getCategoryBrandPro();
    // console.log(this.brand, this.category);
  },
};
</script>

<style scoped></style>
